﻿using System;
using System.Runtime.InteropServices;
using System.Text;

namespace Scenario.WAPI
{
    public partial class ProcessHelper
    {
        [DllImport("WAPI.dll", EntryPoint = "createNewProcessInstance" ,CharSet = CharSet.Ansi)]
        [ return: MarshalAs(UnmanagedType.AnsiBStr)]
        public static extern String CreateProcessInstance(String sWorkflowName, StringBuilder processID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "startProcessInstance", CharSet = CharSet.Ansi)]
        public static extern void StartProcessInstance(String lProcessID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "startProcessInSynchWay", CharSet = CharSet.Ansi)]
        public static extern void StartProcessInstanceInSynchWay(String lProcessID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "restartProcessInstance", CharSet = CharSet.Ansi)]
        private static extern void RestartProcessInstance(String lProcessID, String sActivity, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "setProcessInstanceAttributes", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String SetProcessInstanceAttributes(String lProcessID, String xmlAttributes, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getProcessAttribute", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetProcessAttribute(String lProcessID, string sAttributeName, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "UpdateProcessInstanceAttributes", CharSet = CharSet.Ansi)]
        private static extern void UpdateProcessInstanceAttributes(String lProcessID, String xmlAttributes, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getProcessInstanceAttributes", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetProcessInstanceAttributes(String lProcessID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getNextActivityList", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetNextActivityList(String lProcessID, String sActivity, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getActivityResultList", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetActivityResultList(String processID, String sActivity, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getProcessInstance", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetProcessInstance(String processID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "LoadProcessInstance", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String LoadProcessInstance(String processID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getProcessHeader", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetProcessHeader(String processID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getNewProcessHeader", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetNewProcessHeader(String processID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getProcessStatus", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetProcessStatus(String processID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getProcesses", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetProcesses(ref Response response);

        [DllImport("WAPI.Dll", EntryPoint = "getReports", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetReports(String processID, ref Response response);

        [DllImport("WAPI.dll", EntryPoint = "getWorkflowList", CharSet = CharSet.Ansi)]
        [return: MarshalAs(UnmanagedType.AnsiBStr)]
        private static extern String GetWorkflowList(ref Response response);
    }
}
